package com.sansheng.dto;

import com.sansheng.entity.ChannelInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import static java.lang.System.out;

@Repository
public class Channeldto {

    @Autowired
    private ChannelInfo channelInfo;
    public ChannelInfo create(String channelID, String name, String type, String cid, String records, String pnum, String ofield, String sort, String needRecord, String format, String duration, String filename, String cidList, String begintime, String endtime, String setSignKey, String outputName, String vidList) {

        //判断
        if(channelID==null)

        return null;

        if (name != null) {
            channelInfo.setName(name);
        } else  {
            out.println("name is null");
        }

        if (type != null) {
            channelInfo.setType(type);
        } else  {
            out.println("type is null");
        }

        if (cid != null) {
            channelInfo.setCid(cid);
        } else  {
            out.println("cid is null");
        }
        if (records != null) {
            channelInfo.setRecords(records);
        } else  {
            out.println("records is null");
        }
        if (pnum != null) {
            channelInfo.setPnum(pnum);
        } else  {
            out.println("name is null");
        }

        if (ofield != null) {
            channelInfo.setOfield(ofield);
        } else  {
            out.println("ofield is null");
        }

        if (sort != null) {
            channelInfo.setSort(sort);
        } else  {
            out.println("sort is null");
        }

        if (needRecord != null) {
            channelInfo.setNeedRecord(needRecord);
        } else  {
            out.println("needRecord is null");
        }

        if (format != null) {
           channelInfo.setFormat(format);
        } else  {
            out.println("format is null");
        }

        if (duration != null) {
            channelInfo.setDuration(duration);
        } else  {
            out.println("duration is null");
        }

        if (filename != null) {
            channelInfo.setFilename(filename);
        } else  {
            out.println("filename is null");
        }

        if (cidList != null) {
            channelInfo.setCid(cidList);
        } else  {
            out.println("cidList is null");
        }

        if (begintime != null) {
            channelInfo.setBegintime(begintime);
        } else  {
            out.println("begintime is null");
        }

        if (endtime != null) {
            channelInfo.setEndtime(endtime);
        } else  {
            out.println("endtime is null");
        }

        if (setSignKey != null) {
            channelInfo.setSetSignKey(setSignKey);
        } else  {
            out.println("setSingkey is null");
        }

        if (outputName != null) {
            channelInfo.setOutputName(outputName);
        } else  {
            out.println("outputName is null");
        }

        if (vidList != null) {
            channelInfo.setVidList(vidList);
        } else  {
            out.println("vidList is null");
        }
        return channelInfo;

    }
}
